use turbo_tasks::Vc;
use turbopack_core::{module::Module, resolve::ModulePart, source::Source};
use turbopack_ecmascript::EcmascriptInputTransforms;

use crate::ModuleAssetContext;

#[turbo_tasks::value_trait]
pub trait CustomModuleType {
    #[turbo_tasks::function]
    fn create_module(
        self: Vc<Self>,
        source: Vc<Box<dyn Source>>,
        module_asset_context: Vc<ModuleAssetContext>,
        part: Option<ModulePart>,
    ) -> Vc<Box<dyn Module>>;

    #[turbo_tasks::function]
    fn extend_ecmascript_transforms(
        self: Vc<Self>,
        preprocess: Vc<EcmascriptInputTransforms>,
        main: Vc<EcmascriptInputTransforms>,
        postprocess: Vc<EcmascriptInputTransforms>,
    ) -> Vc<Box<dyn CustomModuleType>>;
}
